package com.ms.mapper;

import com.ms.pojo.Resign_apply;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;

@Mapper
public interface ResignApplyMapper {
    /**
     * 查询所有离职申请
     */
    @Select("SELECT * FROM resign_apply ORDER BY apply_time DESC")
    List<Resign_apply> selectAllResignApplies();

    /**
     * 同意离职申请（更新状态为1）
     */
    @Update("UPDATE resign_apply SET apply_status = 1 WHERE resign_id = #{resignId}")
    int agreeResignApply(Integer resignId);

    /**
     * 拒绝离职申请（更新状态为2）
     */
    @Update("UPDATE resign_apply SET apply_status = 2 WHERE resign_id = #{resignId}")
    int rejectResignApply(Integer resignId);
}
